home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
Miscellaneous
/
ival
/
ival.h
< prev
next >
Wrap
Text File
|
1987-05-25
|
7KB
|
267 lines
/*
* ival.h - common declarations for the Interval Study program.
* Needs: quickdraw.h, window.h
* Owned by: ival.c
*/
#define MYSIGN ((long) 'BN34') /* Interval's signature */
#define MYFILE ((long) 'BN35') /* Interval's files' signature (unused) */
#define WINDOWID 260 /* Resource ID of my window */
#define HMARGIN 15 /* min horz distance between objects */
#define BUTTONFONT systemFont /* font for control labels */
#define BUTPROCID 0 /* ProcID of a standard button */
#define RADPROCID 2 /* ProcID of a radio button */
#define BUTHEIGHT 19 /* height of a standard button */
#define BUTEXTRAH 20 /* non-name horz part of a button */
#define BUTVMARG 1 /* vertical margin between buttons */
#define BUTHMARG 5 /* horizontal margin between buttons */
/*
* screenport - used to keep the current port from ever dangling.
* This is a port for the whole screen.
*/
#ifndef DATA
extern
#endif
GrafPtr screenport;
#ifndef DATA
extern
#endif
WindowPtr windoc; /* the program's one window */
/*
* *rect - bounds of the areas of the screen.
* Each area of the screen is described by one of the following rects:
* cntlrect - the Control area;
* namerect - the Name area;
* noterect - the Notation area.
*/
#ifndef DATA
extern Rect cntlrect;
extern Rect namerect;
extern Rect noterect;
#else
Rect cntlrect;
Rect namerect;
Rect noterect;
#endif
/*
* scorerect - Rect enclosing the score.
* Scorerect lies completely within noterect.
*/
#ifndef DATA
extern
#endif
Rect scorerect;
/*
* progtasks, studtasks - booleans saying who provides what.
*/
struct tasks {
short notate; /* "provides notation" */
short name; /* "provides name" */
short sound; /* "provides sound" */
};
#ifndef DATA
extern struct tasks progtasks; /* what the program provides */
extern struct tasks studtasks; /* what the student provides */
#else
struct tasks progtasks;
struct tasks studtasks;
#endif
/*
* acc_ok - accidentals are allowed.
*/
#ifndef DATA
extern
#endif
int acc_ok;
/*
* SEQ_* - how a sequence of tones are to be played:
* SEQ_HARM - harmonic
* SEQ_MEL - melodically
* SEQ_MIX - a choice of harmonic or melodic.
*/
#define SEQ_HARM 0
#define SEQ_MEL 1
#define NUM_SEQ 2 /* number of sequence values (0 or 1) */
#define SEQ_MIX 2
/*
* cur_seq - the way the current sequence of tones is to be played.
* One of SEQ_HARM or SEQ_MEL.
*/
#ifndef DATA
extern
#endif
int cur_seq;
/*
* any_seq - the way any sequence of tones is to be played.
* This value restricts the set of values for cur_seq.
* SEQ_HARM or SEQ_MEL means cur_seq can be only the value for any_seq;
* SEQ_MIX means cur_seq can be either.
*/
#ifndef DATA
extern
#endif
int any_seq;
/*
* *shown - TRUE if the corresponding thing is correctly displayed.
*/
#ifndef DATA
extern short tone1shown; /* the second tone is drawn in the score */
extern short isizeshown; /* the interval size is correctly shown */
extern short itypeshown; /* the interval type is correctly shown */
/* (up/down is always shown) */
#else
short tone1shown;
short isizeshown;
short itypeshown;
#endif
/*
* DEGPERSCORE, DEGPEROCT, OCTPERSCORE - definitions of the range of
* representable tones.
*
* Degree 0 == Low C; Semitone 0 = Low C.
*/
#define DEGPERSCORE 29 /* # of degrees in the score */
#define DEGPEROCT 7 /* # of degrees per octave */
#define OCTPERSCORE (DEGPERSCORE / DEGPEROCT) /* octaves in the score*/
#define SEMPEROCT 12 /* semitones per octave */
#define NUMTONES 2 /* # of tones to place on the score */
/*
* DEG_* - some interesting degrees of the scale
*/
#define DEG_MIDC 14 /* middle C */
#define DEG_LOWF 3 /* F below Bass Clef */
#define DEG_HIGG 25 /* G above Treble Clef */
/*
* IT_* - interval types (qualities)
*/
#define IT_AUG 0 /* augmented */
#define IT_PERF 1 /* perfect */
#define IT_MAJ 2 /* major */
#define IT_MIN 3 /* minor */
#define IT_DIM 4 /* diminished */
#define IT_COUNT 5 /* number of IT_* items */
/*
* ivinfo[] - table relating interval # of semitones and delta degrees
* to its type. A .semis value less than 0 ends the table.
*/
struct ivinfo {
short semis; /* number of semitones */
short degs; /* degrees in this interval (its isize) */
short qual; /* its quality (itype. E.g., IT_MAJ) */
};
#ifndef DATA
extern struct ivinfo ivinfo[];
#else
struct ivinfo ivinfo[] = {
{ 0, 1 - 1, IT_PERF}, /* Perfect Unison */
{ 1, 1 - 1, IT_AUG}, /* Augmented Unison */
{ 0, 2 - 1, IT_DIM}, /* Diminished 2nd */
{ 1, 2 - 1, IT_MIN}, /* Minor 2nd */
{ 2, 2 - 1, IT_MAJ}, /* Major 2nd */
{ 3, 2 - 1, IT_AUG}, /* Augmented 2nd */
{ 2, 3 - 1, IT_DIM}, /* Diminished 3rd */
{ 3, 3 - 1, IT_MIN}, /* Minor 3rd */
{ 4, 3 - 1, IT_MAJ}, /* Major 3rd */
{ 5, 3 - 1, IT_AUG}, /* Augmented 3rd */
{ 4, 4 - 1, IT_DIM}, /* Diminished 4th */
{ 5, 4 - 1, IT_PERF}, /* Perfect 4th */
{ 6, 4 - 1, IT_AUG}, /* Augmented 4th */
{ 6, 5 - 1, IT_DIM}, /* Diminished 5th (tritone) */
{ 7, 5 - 1, IT_PERF}, /* Perfect 5th */
{ 8, 5 - 1, IT_AUG}, /* Augmented 5th */
{ 7, 6 - 1, IT_DIM}, /* Diminished 6th */
{ 8, 6 - 1, IT_MIN}, /* Minor 6th */
{ 9, 6 - 1, IT_MAJ}, /* Major 6th */
{ 10, 6 - 1, IT_AUG}, /* Augmented 6th */
{ 9, 7 - 1, IT_DIM}, /* Diminished 7th */
{ 10, 7 - 1, IT_MIN}, /* Minor 7th */
{ 11, 7 - 1, IT_MAJ}, /* Major 7th */
{ 12, 7 - 1, IT_AUG}, /* Augmented 7th */
{ 11, 8 - 1, IT_DIM}, /* Diminished Octave */
{ 12, 8 - 1, IT_PERF}, /* Perfect Octave */
{ -1, -1, -1}
};
#endif
/*
* curkey - the current key
*/
struct akey {
short insharps; /* TRUE= a key in sharps; FALSE= a key in flats */
short number; /* number of sharps/flats (0..DEGPEROCT) */
};
#ifndef DATA
extern
#endif
struct akey curkey;
/*
* curtone[] - the current tones being played/displayed.
*/
struct atone {
short degree; /* degrees above low C */
short chrome; /* chromatic adjustment (in semitones) */
};
#define CH_FLAT (-1) /* a flat adjustment in atone.chrome */
#define CH_NAT 0 /* a natural " " " " */
#define CH_SHARP 1 /* a sharp " " " " */
#define NUM_CH 3 /* number of CH_* modifiers */
#ifndef DATA
extern
#endif
struct atone curtone[NUMTONES];
/*
* curitype, curisize - the current interval's size and type.
*/
#ifndef DATA
extern short curitype;
extern short curisize;
#else
short curitype;
short curisize;
#endif